﻿using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;

class HUD
{
    private ScreenManager screenManager;

    private Texture2D leftSideKeijow;
    private Texture2D rightSideKeijow;
    private Texture2D leftSideManteiga;
    private Texture2D rightSideManteiga;
    private Texture2D heartTexture;

    public HUD(ScreenManager screenManager)
    {
        // check the parameter
        if (screenManager == null)
        {
            throw new ArgumentNullException("screenManager");
        }
        this.screenManager = screenManager;
    }

    SpriteFont spriteFont;

    public void LoadContent()
    {
        ContentManager content = screenManager.Game.Content;

        spriteFont = content.Load<SpriteFont>("SpriteFont1");

        leftSideKeijow = content.Load<Texture2D>(@"Textures\MenuMock\GUI_esquerda_gelo");
        rightSideKeijow = content.Load<Texture2D>(@"Textures\MenuMock\GUI_direita_gelo");
        leftSideManteiga = content.Load<Texture2D>(@"Textures\MenuMock\GUI_esquerda_fogo");
        rightSideManteiga = content.Load<Texture2D>(@"Textures\MenuMock\GUI_direita_fogo");

        heartTexture = content.Load<Texture2D>(@"Textures\MenuMock\coraçao");
    }

    public void Draw(PlayerAndChar players)
    {
        SpriteBatch spriteBatch = screenManager.SpriteBatch;

        spriteBatch.Begin();

        switch (players)
        {
            case PlayerAndChar.CHARA:
                for (int i = 0; i < GameSession.keiJow.Life; i++)
                {
                    spriteBatch.Draw(heartTexture, new Vector2(175 + (20 * i), 55), Color.White);
                }

                spriteBatch.Draw(leftSideKeijow, new Vector2(95, 50), Color.White);
                break;
            case PlayerAndChar.CHARB:
                for (int i = 0; i < GameSession.manteiga.Life; i++)
                {
                    spriteBatch.Draw(heartTexture, new Vector2(175 + (20 * i), 55), Color.White);
                }

                spriteBatch.Draw(leftSideManteiga, new Vector2(95, 50), Color.White);
                break;
            case PlayerAndChar.CHARACHARB:
                for (int i = 0; i < GameSession.keiJow.Life; i++)
                {
                    spriteBatch.Draw(heartTexture, new Vector2(175 + (20 * i), 55), Color.White);
                }
                for (int i = 0; i < GameSession.manteiga.Life; i++)
                {
                    spriteBatch.Draw(heartTexture, new Vector2(1075 - (20 * i), 55), Color.White);
                }

                spriteBatch.Draw(leftSideKeijow, new Vector2(95, 50), Color.White);
                spriteBatch.Draw(rightSideManteiga, new Vector2(1097, 50), Color.White);
                break;
            case PlayerAndChar.CHARBCHARA:
                for (int i = 0; i < GameSession.manteiga.Life; i++)
                {
                    spriteBatch.Draw(heartTexture, new Vector2(175 + (20 * i), 55), Color.White);
                }
                for (int i = 0; i < GameSession.keiJow.Life; i++)
                {
                    spriteBatch.Draw(heartTexture, new Vector2(1075 - (20 * i), 55), Color.White);
                }

                spriteBatch.Draw(leftSideManteiga, new Vector2(95, 50), Color.White);
                spriteBatch.Draw(rightSideKeijow, new Vector2(1097, 50), Color.White);
                break;
        }

        spriteBatch.End();
    }

}